using System;
using System.Collections.Generic;
using System.Text;
using System.Xml;

namespace Eve.API
{
    /// <summary>
    /// Represents very basic information about a character.
    /// </summary>
    /// <remarks>
    /// A list of  <b>CharacterInfo</b> classes is returned by the <see cref="Eve.API.EveAPI.GetCharacters">GetCharacters</see> method in the <b>EveAPI</b> class.  
    /// This list represents the characters that are associated with the user account.
    /// </remarks>
    /// <example>
    /// The following example show how to retrieve a list of characters associated with a user account:
    /// <code lang="C#">
    ///         // Create an instance of EveAPI
    ///         EveAPI api = new EveAPI(12345, "LmSjbo1rrXcUqYwxJ13HihJ67cgVA7IyvyZP1VvCWs9htptqTVddH9TmUNS0ExsV");
    ///
    ///         // Get a list of all characters on this account 
    ///         List&lt;CharacterInfo&gt; characters;
    ///         api.GetCharacters(out characters);
    /// </code>
    /// <code lang="vb">
    ///         ' Create an instance of EveAPI
    ///         Dim api As New EveAPI(12345, "LmSjbo1rrXcUqYwxJ13HihJ67cgVA7IyvyZP1VvCWs9htptqTVddH9TmUNS0ExsV")
    ///
    ///         ' Get a list of all characters on this account 
    ///         Dim characters As List(Of CharacterInfo)
    ///         api.GetCharacters(characters)
    /// </code>
    /// </example>
    [Serializable]
    public class CharacterInfo
    {
        private NameId character;
        private NameId corporation;

        /// <summary>
        /// Gets the character's name and Eve internal identifier
        /// </summary>
        /// <value>
        /// The character name and identifier
        /// </value>
        public NameId Character
        {
            get { return character; }
        }
        /// <summary>
        /// Gets the character's corporation name and Eve internal identifier
        /// </summary>
        /// <value>
        /// The corpoartion name and identifier that the character is a member of
        /// </value>
        public NameId Corporation
        {
            get { return corporation; }
        }

        internal CharacterInfo(XmlElement ci)
        {
            character.Id = int.Parse(ci.Attributes["characterID"].Value);
            character.Name = ci.Attributes["name"].Value;
            corporation.Id = int.Parse(ci.Attributes["corporationID"].Value);
            corporation.Name = ci.Attributes["corporationName"].Value;
        }
    }
}
